package edu.usm.predatorwars;

import java.util.concurrent.LinkedBlockingQueue;

import edu.predatorwars.shared.models.Message;

public class DefaultGameEventConsumer implements GameEventConsumer {

	private final LinkedBlockingQueue<Message> eventQueue = new LinkedBlockingQueue<Message>();

	public void addMessage(Message message) {
		eventQueue.offer(message);
	}

	public Message nextGameEvent() {
		try {
			return eventQueue.take();
		} catch (InterruptedException e) {
			return null;
		}
	}
}
